<template>
  <el-card>
    <div slot="header">正反旋转</div>
    <div class="rotate-box-wrapper">
      <div class="rotate-box">
        <div class="front">hello html</div>
        <div class="back">hello css</div>
      </div>
    </div>
  </el-card>
</template>

<script>
export default {}
</script>

<style lang="less" scoped>
@import url('./common.less');
.rotate-box {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto;
  transition: all 0.2s;
  /* 保留立体空间，表示改变的是三维空间 */
  transform-style: preserve-3d;

  &:hover {
    transform: rotateY(180deg);
  }

  .front,
  .back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    font-size: 30px;
    color: #ffffff;
    text-align: center;
    line-height: 300px;
  }
  .front {
    background-color: pink;
    z-index: 1;
  }
  .back {
    background-color: purple;
    /* 背靠背效果 */
    transform: rotateY(180deg);
  }
}
</style>
